package com.polaris.live.adapter

import com.bumptech.glide.Glide
import com.polaris.live.common.adapter.BaseBindingAdapter
import com.polaris.live.common.adapter.VBViewHolder
import com.polaris.live.databinding.AdapterHonorItemUserProfileBinding
import com.polaris.live.resp.back_resp.UserMedalVo
import com.polaris.live.utils.image.loadImage

/**
 * HonorUserProfileAdapter
 *
 * @author Created by 半仙 on 2024/1/31/031 9:33
 */
class HonorUserProfileAdapter : BaseBindingAdapter<AdapterHonorItemUserProfileBinding, UserMedalVo>() {

    override fun convert(
        holder: VBViewHolder<AdapterHonorItemUserProfileBinding>,
        item: UserMedalVo,
    ) {
        holder.vb.apply {
            if (item.createTime == null) {
                Glide.with(honorItemIcon).loadImage(item.fallbackPhotoUrl).into(honorItemIcon)
            } else {
                Glide.with(honorItemIcon).loadImage(item.photoUrl).into(honorItemIcon)
            }
        }
    }
}